package com.promise.jokerdream.response.pc

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

// 九宫宝库回包
@Serializable
data class QueryLotteryResponse(
    override val result: Int,
    override val msg: String = "",
    // 抽奖卡数量
    @SerialName("lottery_card_num")
    val lotteryCardNum: Int = 0,
    // 已经打开的序号，从0开始到8
    val opened: List<Int> = emptyList(),
    // 已经打开的宝箱
    @SerialName("opened_boxes")
    val openedBoxes: List<LotteryRewardsModel> = emptyList(),
    // 所有的宝箱
    @SerialName("box_rewards")
    val boxRewards: List<LotteryRewardsModel> = emptyList()
): BasePCResponse {
    override fun getDescription(): String {
        return msg
    }
}

@Serializable
data class LotteryRewardsModel(
    val type: Int = 0,
    @SerialName("goods_name")
    val goodsName: String = "",
    @SerialName("goods_num")
    val goodsNum: Int = 0,
    // 倍率
    val times: Int = 0,
) {
    fun getDescription(): String {
        return when (type) {
            1 -> {
                "${goodsName}*${goodsNum}"
            }

            2 -> {
                "${times}倍暴击"
            }

            else -> {
                ""
            }
        }
    }
}
